﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace InputTool
{
    public partial class ucCompany : UserControl
    {
        public ucCompany()
        {
            InitializeComponent();
        }
        private List<string> _names;

        public List<string> Names
        {
            get { return _names; }
            set { _names = value; }
        }
        public ucCompany(List<string> names)
        {
            this._names = names;
            InitializeComponent();
            this.Text = "请点击您的企业名称";
            Size size = new Size(900, 40);
            for (int i = 0; i < _names.Count; i++)
            {
                Point point = new Point(30, 20 + i * 45);
                Button btn = new Button();
                btn.Name = string.Format("btn{0}", i + 1);
                btn.Text = _names[i];
                btn.Size = size;
                btn.BackColor = Color.LightBlue;
                btn.Location = point;
                btn.Font = new Font("楷体", 16);
                btn.Visible = true;
                btn.Enabled = true;
                btn.Click += new System.EventHandler(btn_Click);
                this.Controls.Add(btn);
            }
        }
        private void btn_Click(object sender, EventArgs e)
        {
            Button btn = sender as Button;
            Company._selectName = btn.Text;
            Company._isClickCompany = true;
           
        }
        private void ucCompany_Load(object sender, EventArgs e)
        {

        }
    }
}
